 package srdb.migration.dbhandler.enterprisedb;
 
 import com.edb.Driver;

 import java.io.FileInputStream;
 import java.sql.SQLException;
import java.util.Properties;

 import srdb.migration.Util.DBInfo;
 import srdb.migration.Utility;
import srdb.migration.common.MTKConnection;
 
 public class EnterpriseDBConnection extends MTKConnection
 {
   private Driver driver = null;
   private boolean redwoodMode = true;
   private String dbDialect = null;
 
   public EnterpriseDBConnection(String dbURL, String dbUser, String dbPassword) throws Exception {
     super(dbURL, dbUser, dbPassword);
 
     this.driver = new Driver();
 
     Properties prop = new Properties();
     prop.setProperty("user", dbUser);
     prop.setProperty("password", dbPassword);
     prop.setProperty("loginTimeout", "10");
     prop.setProperty("detmsgencoding", "");
     Driver.setLogLevel(1);
     Driver.setPrintInfo(false);
     this.conn = this.driver.connect(dbURL, prop);
   }
 
   public EnterpriseDBConnection(String propertiesFile) throws Exception
   {
     super(propertiesFile);
 
     Properties ini = new Properties();
     ini.load(new FileInputStream(propertiesFile));
 
     this.dbURL = ini.getProperty("EDBConnection");
     this.dbUser = ini.getProperty("EDBUser");
     this.dbPassword = ini.getProperty("EDBPassword");
     this.driver = new Driver();
 
     Properties prop = new Properties();
     prop.setProperty("user", this.dbUser);
     prop.setProperty("password", this.dbPassword);
     prop.setProperty("loginTimeout", "10");
     prop.setProperty("detmsgencoding", "");
     this.conn = this.driver.connect(this.dbURL, prop);
   }
 
   public boolean isRedwoodMode()
     throws SQLException
   {
     if (this.dbDialect == null) {
       this.dbDialect = Utility.readGUC(getConnection(), "db_dialect");
       this.redwoodMode = ((this.dbDialect != null) && (this.dbDialect.equalsIgnoreCase("redwood")));
     }
 
     return this.redwoodMode;
   }


   @Override
   public boolean preConnectDB(String[] parms) throws Exception {
     //todo
     return false;
   }
 }

/* 

 * 
 */